﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using AdminHome.DatabaseServices;
namespace MVCSiteJDG.Controllers
{
    public class AdminHomeController : Controller
    {
        //
        // GET: /AdminHome/

        public ActionResult Index()
        {
            if (ModelState.IsValid && Session["UserName"] != null)
            {
                return AdminHome();
            }
            else
            {
               return Crash();
            }
        }
        public ActionResult AdminHome()
        {
            if (ModelState.IsValid && Session["UserName"] != null)
            {
                return View();
            }
            else
            {
               return Crash();
            }
        }
        public ActionResult AdminPurchase()
        {
            if (ModelState.IsValid && Session["UserName"] != null)
            {
                return View();
            }
            else
            {
               return Crash();
            }
        }
        public ActionResult AdminShoppingCart()
        {
            if (ModelState.IsValid && Session["UserName"] != null)
            {
                return View();
            }
            else
            {
               return Crash();
            }
        }
        public ActionResult AdminRequestOrder()
        {
            if (ModelState.IsValid && Session["UserName"] != null)
            {
                return View();
            }
            else
            {
                return Crash();
            }
        }
        public ActionResult AdminAddLocation()
        {
            if (ModelState.IsValid && Session["UserName"] != null)
            {
                return View();
            }
            else
            {
               return Crash();
            }
        }
        public ActionResult AdminAddAssets()
        {
            if (ModelState.IsValid && Session["UserName"] != null)
            {
                return View();
            }
            else
            {
               return Crash();
            }
        }

        public ActionResult Crash()
        {
            return View();
        }

        public ActionResult Crashed()
        {
            return View();
        }

        [HttpPost]
        public void createAsset(string departmentID, string subCategoryID, string productID)
        {
            AdminHomeDatabaseMethods.createAsset(departmentID, subCategoryID, productID);
        }

        [HttpPost]
        public void createLog(string requestId, string message)
        {
            AdminHomeDatabaseMethods.createLog(requestId, message);
        }
        [HttpPost]
        public void createOrderLineItem(string productId, string productQuantity, string orderId)
        {
            AdminHomeDatabaseMethods.createLineItem( productId, productQuantity, orderId);
        }
        [HttpPost]
        public void createOrder(string orderStatus,string totalCost, string departmentId)
        {
            AdminHomeDatabaseMethods.createOrder(orderStatus, totalCost, departmentId);
        }
        [HttpPost]
        public void createProduct(string productName, string productDescription, string productPrice, string productImage, string productInDate, string catID)
        {
            var temp = AdminHomeDatabaseMethods.createProduct(productName, productDescription, productPrice, productImage, productInDate, catID);
        }
        [HttpPost]
        public void createRequest(string accountID, string technicianID, string requestMessage)
        {
            AdminHomeDatabaseMethods.createRequest(accountID, technicianID, requestMessage);
        }
        [HttpPost]
        public void createShoppingCart(string shoppingDate, string accountID)
        {
            AdminHomeDatabaseMethods.createShoppingCart(shoppingDate, accountID);
        }
        [HttpPost]
        public void createDepartment(string building, string floor, string room, string costCentreID)
        {
            AdminHomeDatabaseMethods.createDepartment(building, floor, room, costCentreID);
        }
    }
}
